<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateQuestionInfo extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('question_info', ['comment' => '问卷被访问信息表']);
        $table->addColumn('city_counties_area', 'string',array('limit' => 355, 'null' => true,'comment' => '市县区'))
            ->addColumn('age', 'integer',array('limit' => 11, 'default' => 0, 'comment' => '年龄'))
            ->addColumn('industry', 'string',array('limit' => 130, 'null' => true, 'comment' => '行业'))
            ->addColumn('name', 'string',array('limit' => 31, 'null' => true, 'comment' => '姓名'))
            ->addColumn('branch_name', 'string',array('limit' => 61, 'null' => true, 'comment' => '支行名称'))
            ->addColumn('jobs', 'string',array('limit' => 130, 'null' => true,'comment' => '岗位'))
            ->addColumn('gender', 'string',array('limit' => 130, 'null' => true, 'comment' => '性别'))
            ->addColumn('phone', 'string',array('limit' => 130, 'null' => true,'comment' => '电话'))
            ->addColumn('questionnaire_id', 'integer',array('limit' => 30,'default' => 0, 'comment' => '问卷id'))
            ->addColumn('create_id', 'integer',array('limit' => 30,'default' => 0, 'comment' => '用户id'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();
    }
}
